package com.drcoffee.drcoffeemall.mapper;

import com.drcoffee.drcoffeemall.entry.Machine;
import com.drcoffee.drcoffeemall.entry.MachineAndAttachment;
import com.drcoffee.drcoffeemall.entry.Type;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/*
 * 机器
 * */
@Mapper
@Repository
public interface MachineMapper {
    /**
     * 查询机器和组件
     */
    List<MachineAndAttachment> getMachineAndAttachment(List<Integer> id);

    int[] getMachineId(@RequestParam("part_code") String part_code, @RequestParam("cn_name") String cn_name, @RequestParam("en_name") String en_name);

    /*
     * 查询机器
     * */
    List<Machine> getMachine(Integer type_id, String search);

    /*
     * 查询机器All
     * */
    List<Machine> getMachineAll(String name);

    /*
     * 根据id查询机器
     * */
    Machine getMachineById(Integer id);

    @Select("SELECT * FROM t_type WHERE state = 'Y'")
    List<Type> getType();
}
